home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-29 | 2.9 KB | 125 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 1 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //=======================================================================
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- // ----- Framework Layer -----
- #ifndef FWUTIL_H
- #include "FWUtil.h" // FW_CFacetContext, FW_Beep()
- #endif
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h" // FW_CViewContext
- #endif
-
- // ----- OS Layer -----
- #ifndef FWMENU_H
- #include "FWMenu.h" // FW_CMenuBar, etc.
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h" // FW_CMenuEvent, FW_CMouseEvent
- #endif
-
- #ifndef FWALERT_H
- #include "FWAlert.h" // FW_CAlert
- #endif
-
- #ifndef SLMIXCOS_H
- #include "SLMixOS.h" // FW_Beep
- #endif
-
- // ----- Graphic Includes -----
- #ifndef FWRECT_H
- #include <FWRect.h> // FW_CRect
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h" // FW_CRectShape
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Mnu
- #endif
-
- FW_DEFINE_AUTO(CMnuFrame)
-
- //========================================================================================
- CMnuFrame::CMnuFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, CMnuPart* mnuPart)
- : FW_CFrame(ev, odFrame, presentation, mnuPart),
- fMnuPart(mnuPart),
- fSoundOn(true)
- {
- }
-
- //----------------------------------------------------------------------------------------
- CMnuFrame::~CMnuFrame()
- {
- }
-
- //----------------------------------------------------------------------------------------
- void
- CMnuFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape) // Override
- {
- FW_CViewContext context(ev, this, odFacet, invalidShape);
- FW_CRect invalidRect;
- context.GetClipRect(invalidRect);
-
- FW_CRectShape::RenderRect(context, invalidRect, FW_kFill, FW_kWhiteEraseInk); // erase
-
- FW_CRect mnuRect = this->GetBounds(ev);
- FW_CRectShape rectShape(mnuRect, FW_kFill);
- rectShape.GetInk().SetForeColor(FW_kRGBLightGray);
- rectShape.Render(context);
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CMnuFrame::DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus,
- FW_Boolean isRoot) // Override
- {
- if (hasMenuFocus) {
- menuBar->EnableCommand(ev, cItemThreeCommand, true);
- menuBar->EnableAndCheckCommand(ev, cSoundCommand,
- true, // enable
- fSoundOn); // checkmark
- }
- return false;
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CMnuFrame::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent) // Override
- {
- FW_Boolean menuHandled = true;
-
- switch (theMenuEvent.GetCommandID(ev))
- {
- case cItemThreeCommand:
- if (fSoundOn) FW_Beep();
- break;
-
- case cSoundCommand:
- fSoundOn = !fSoundOn;
- break;
-
- default:
- menuHandled = false;
- }
- return menuHandled;
- }
-
-